#ifndef __SPS_HPP__
#define __SPS_HPP__

#include "interface.hpp"


#define H264_MAX_SPS_COUNT 32  //0-31


class NaluSPS: public Nalu{
public:
    NaluSPS(const Nalu & nalu);
    virtual int Parse() override;
    int GetWidthHeight();

    int width;
    int Height;
    int ChromaArrayType = 0;
    int SubWidthC = 0;
    int subHeightC = 0;

    int8_t profile_idc;          //8bit   当前这路码流的编码档次，常见的有baseline profile--66, main profile--77, extend profile--88
    int8_t constraint_set0_flag; //1bit   在编码的档次方面对码流增加的其它一些额外限制性条件
    int8_t constraint_set1_flag; //1bit  
    int8_t constraint_set2_flag; //1bit 
    int8_t constraint_set3_flag; //1bit
    int8_t constraint_set4_flag; //1bit
    int8_t constraint_set5_flag; //1bit
    int8_t reserved_zero_2bit = 0;   //4bit    应等于0。reserved_zero_4bits的其它取值将由 ITU-T | ISO/IEC 未来规定
    int8_t level_idc;            //8bit    标识当前码流的Level
   
    int    seq_parameter_set_id;  //ue 
    int    chroma_format_idc = 1;    //ue
    int8_t separate_colour_plane_flag = 0; //1bit 
    int    bit_depth_luma_minus8 = 0;  //ue
    int    bit_depth_chroma_minus8 = 0; //ue
    int8_t qpprime_y_zero_transform_bypass_flag; //u1
    int8_t seq_scaling_matrix_present_flag ; //u1
    int8_t seq_scaling_list_present_flag[12]; //u1

    int    log2_max_frame_num_minus4; //ue
   
    int    pic_order_cnt_type; //ue
    int    log2_max_pic_order_cnt_lsb_minus4;
    int8_t delta_pic_order_always_zero_flag;
    int    offset_for_non_ref_pic;
    int    offset_for_top_to_bottom_field;
    int    num_ref_frames_in_pic_order_cnt_cycle;
    int    offset_for_ref_frame[255];
   
    int    max_num_ref_frames;     //ue
    int8_t gaps_in_frame_num_value_allowed_flag; //1bit
    int    pic_width_in_mbs_minus1;   //ue
    int    pic_height_in_map_units_minus1;  //ue
    
    int8_t frame_mbs_only_flag;  //1bit
    int8_t mb_adaptive_frame_field_flag;

    int8_t direct_8x8_inference_flag; //1bit
    int8_t frame_cropping_flag;  //1bit
    int    frame_cropping_left_offset; //ue
    int    frame_cropping_right_offset;
    int    frame_cropping_top_offset; 
    int    frame_cropping_bottom_offset;
    int8_t vui_parameters_present_flag; //1bit

    int32_t     ScalingList4x4[6][16];
    int32_t     ScalingList8x8[6][64];
    int32_t     UseDefaultScalingMatrix4x4Flag[6];
    int32_t     UseDefaultScalingMatrix8x8Flag[6];
    

};

#endif